﻿@{
    ViewBag.Title = "Add";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model YTCMS.Domain.Entities.users
<div class="page-header">
    <h1>
        <a href="/users/index"> 用户管理</a>
        <small>
            <i class="icon-double-angle-right"></i> 修改用户基础资料
        </small>
    </h1>
</div><!-- /.page-header -->

<div class="row">
    <div class="col-xs-12">
        <div class="row">
            <div class="col-xs-12 ">

            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <form class="form-horizontal" role="form" id="form1" method="post" action="/users/add">
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 用户名 </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.UserName, new { @class = "col-xs-10 col-sm-5 required" })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 密码 </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.Pwd, new { @class = "col-xs-10 col-sm-5 required" })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 邮箱 </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.Email, new { @class = "col-xs-10 col-sm-5 required" })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 联系电话 </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.Mobile, new { @class = "col-xs-10 col-sm-5 " })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 昵称 </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.Nickname, new { @class = "col-xs-10 col-sm-5" })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> QQ </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.QQ, new { @class = "col-xs-10 col-sm-5" })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 性别 </label>
                        <div class="col-sm-9">
                            @Html.RadioButtonFor(s => s.Sex, 1)男
                            @Html.RadioButtonFor(s => s.Sex, 0)女
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 年龄 </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.Age, new { @class = "col-xs-10 col-sm-5" })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 身份证 </label>
                        <div class="col-sm-9">
                            @Html.TextBoxFor(s => s.Identitycard, new { @class = "col-xs-10 col-sm-5" })
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 状态 </label>
                        <div class="col-sm-9">
                            @Html.DropDownListFor(s => s.State, Admin.Common.YTDDL.CommonState(), new { @class = "col-xs-10 col-sm-5" })
                        </div>
                    </div>

                    <div class="clearfix form-actions">
                        <div class="col-md-offset-3 col-md-9">
                            <button class="btn btn-info" type="button" id="btnSave">
                                <i class="icon-ok bigger-110"></i>
                                修改
                            </button>

                            &nbsp; &nbsp; &nbsp;
                            <button class="btn" type="reset">
                                <i class="icon-undo bigger-110"></i>
                                撤销
                            </button>
                        </div>
                    </div>
                </form>
            </div><!-- /span -->
        </div><!-- /row -->
    </div><!-- /.col -->
</div><!-- /.row -->

<script type="text/javascript">
    $(function () {
        jQuery("#form1").validate();
        $("#btnSave").click(function () {
            //$("#form1").submit();
            $.post("/users/add", $("#form1").serialize(), function (data) {
                if (data.d) {
                    jAlert("新增成功", "提示", function () {
                        location.href = "/users/index";
                    })
                }
                else {
                    jAlert(data.msg, "提示");
                }
            })
        });
    })
</script>

